TEGetHeight
long endLine; line number of last line to measure
long startLine; first line to measure
returns height, in dots, of line(s)
TEGetHeight returns the height, in dots, of one or more lines of text in an edit record.
endLine and...
startLine identify which lines to measure. These are used as indexes into the
LHTable, which parallels the lineStarts array in the edit record. If
both values are the same, the height of that single line is returned.
Note that these are 32-bit values, and the order of the parameters
is counter-intuitive.
hTE is a handle obtained via TENew (old style TextEdit record) or TEStylNew (new style TextEdit record). It leads to a variable-length TERec structure and identifies the edit record of interest.
Returns: a short; the height, in pixels, of the lines from startLine to endline, inclusive.
Notes: With style-aware edit records, the height of each line is
maintained automatically in a line-height table, whose handle is found in the
lhTab field of the TEStyleRec associated with the edit record. TEGetHeight looks up and sums the heights of the specified lines. This function also works on old-format edit records, or in style-aware
edit records in which the lineHeight and fontAscent fields are >= 0. In that
case, the return value is the fixed-height of the record-global style,
multiplied by the number of lines in the specified range.
To find which line is associated with a screen point, you must first
determine the offset of the character at the point, read the lineStarts array;
e.g.:
short theOffset, j, found, theHeight;
Point thePt; [TOKEN:12074] some local point */ for ( found=-1, j=0; j< (*hTE)->nLines; j++ ) {
if ( (*hTE)->lineStarts[j]) >= theOffset ) {
found=j; [TOKEN:12074] found it */
break;
}
}
theHeight = TEGetHeight( (long) found. (long) found, hTE ); You might use this function in implementing a manual scroll routine (to
will do that for you.
You can also obtain the height of a single line associated with a particular